"""web URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from . import views,cartviews,orderViews,addressViews
urlpatterns = [
    # 显示首页
    url(r'^$',views.index,name='home_index'),
    # 列表页
    url(r'^list/(?P<tid>[0-9]+)/',views.home_list,name='home_list'),
    # 详情页
    url(r'^info/(?P<gid>[0-9]+)/',views.home_info,name='home_info'),
    # 登录
    url(r'^login/',views.home_login,name='home_login'),
    # 退出登录
    url(r'outlogin/',views.outlogin,name='home_outlogin'),
    # 注册
    url(r'^register/',views.home_register,name='home_register'),
    # 验证码
    url(r'vcode/',views.verifycode,name='vcode'),
    # 短信通知
    url(r'^sendmsg$',views.sendmsg,name='sendmsg'),


    # 购物车显示页面
    url(r'cart/list',cartviews.cart_list,name='home_cart_list'),
    # 商品添加到购物车  存入session
    url(r'cart/add/',cartviews.cart_add,name='home_cart_add'),
    # 购物车数量修改
    url(r'cart/edit',cartviews.cart_edit,name='home_cart_edit'),
    # 删除购物车
    url(r'^cart/del/(?P<gid>[0-9]+)/',cartviews.cart_del,name='home_cart_del'),
    # 清空购物车
    url(r'^cart_clear/',cartviews.cart_clear,name='home_cart_clear'),

    # 确认订单
    url(r'^order/confirm',orderViews.order_confirm,name='home_order_confirm'),
    # 添加地址
    url(r'^address/insert',orderViews.address_insert,name='home_address_insert'),
    # 生成订单
    url(r'^order/create',orderViews.order_create,name='home_order_create'),
    # 支付页面 带过去订代号
    url(r'^order/buy/(?P<oid>[0-9]+)/',orderViews.order_buy,name='home_order_buy'),
    # 支付成功
    url(r'^order/buy/success(?P<oid>[0-9]+)/',orderViews.order_buy_success,name='home_order_buy_success'),
    # 我的订单
    url(r'^myorder/$',orderViews.myorder,name='home_myorder'),
    # 订单详情
    url(r'myorder/info/',orderViews.myorder_info,name='home_myorder_info'),

# 地址管理
    # 地址列表
    url(r'^addresslist/',addressViews.address_list,name='home_address_list'),
    # 修改地址
    url(r'^address/up/',addressViews.address_up,name='home_address_up'),
    # 删除 地址
    url(r'^address/sel/',addressViews.address_del,name='home_address_del'),
    # 修改地址默认值
    url(r'^address/defalut',addressViews.address_defalut,name='home_address_defalut'),
# 个人信息
    # 显示个人信息
    url(r'^personal/',views.personal,name='home_personal'),
    # 修改个人信息
    url(r'^uppersonal/',views.up_personal,name='home_up_personal')
]
